    {%for post in posts%}
        <h2>
            <a href="{{ url_for('blog.post', id=post.id) }}">{{post.title}}</a>
        </h2>
        <p class="lead">
            by <a href="{{ url_for('blog.user', username=post.author.username) }}">{{post.author.username}}</a>
        </p>
        <p><span class="glyphicon glyphicon-time"></span> {{post.created_date.strftime('%Y-%m-%d %H:%M:%S %p')}}</p>
        <!--<hr>-->
        <!--<img class="img-responsive" src="http://placehold.it/900x300" alt="">-->
        <!--<hr>-->
        <div class="post-content">
            <p>{{post.main_content|safe}}</p>
            <div class="post-footer">
                {% if current_user == post.author %}
                <a href="{{ url_for('blog.post_form', id=post.id) }}">
                    <span class="label label-primary">Edit</span>
                </a>
                <a href="{{ url_for('blog.delete_post', id=post.id) }}">
                    <span class="label label-default">Delete</span>
                </a>
                {% elif current_user.is_administrator() %}
                <a href="{{ url_for('blog.post_form', id=post.id) }}">
                    <span class="label label-danger">Edit [Admin]</span>
                </a>
                <a href="{{ url_for('blog.delete_post', id=post.id) }}">
                    <span class="label label-default">Delete [Admin]</span>
                </a>
                {% endif %}
                <a href="{{ url_for('blog.post', id=post.id) }}">
                    <span class="label label-default">Permalink</span>
                </a>

                <a href="{{ url_for('blog.post', id=post.id) }}#comments">
                    <span class="label label-primary">{{ post.comments.count() }} Comments</span>
                </a>
            </div>
        </div>
    <hr>
    {%endfor%}

